package com.base.common.util;

import java.util.Collection;

/**
 * @author yanjiaqiang
 * @date 2010-12-28
 * @version $Id: CollectionUtils.java 7 2011-07-15 04:24:04Z JiaqiangYan@gmail.com $
 */
public class CollectionUtils {

	/**
	 * 将b的元素全部加入到a中
	 * 
	 * @param <E>
	 * @param a
	 * @param b
	 * @return
	 */
	public static <E> boolean addAll(Collection<? super E> a, Collection<E> b) {
		if (b == null) {
			return true;
		}
		boolean result = true;
		for (E e : b) {
			result |= a.add(e);
		}
		return result;
	}

	public static boolean isNullOrEmpty(Collection<?> c) {
		return c == null || c.isEmpty();
	}

}
